Gun = Class.extend({
    init: function (context,width,height,pickedGun,munitions) {
        this.context = context;
        this.width = width;
        this.height = height;
        this.pickedGun = pickedGun;
        this.munitions = munitions;
        
        this.shootEnd = false;
    },
    
    clear : function (x,y,width,height) {
      this.context.clearRect(x, y, width, height);
    },
    
    draw: function (pickImgFromX,pickImgFromY,x) {
        this.pickImgFromX = pickImgFromX;
        this.pickImgFromY = pickImgFromY;
        this.x = x;
        this.context.drawImage(this.pickedGun,
                                this.pickImgFromX, this.pickImgFromY,
                                150,150,
                                this.x,473,
                                250,200);  
    },
    shoot: function (imagePixels) {
        var shootArray = [];
        for(var int = 0; int < 4 ; int++ ){
            shootArray[int] = imagePixels;
            imagePixels += 200;
            if(int === 3 ){
                imagePixels = 400;
                shootArray[int] = imagePixels;
            }

        }
        return shootArray;

    },
    reload: function (imagePixels) {
        var reloadArray = [];
        for(var int = 0; int < 4 ; int++ ){
            reloadArray[int] = imagePixels;
            imagePixels += 200;
        }
        return reloadArray;
    },
    fastShoot: function(count,arrayWithImages,x,gunAnimation){
        
        gunAnimation.clear(0,503,1024,170);
        gunAnimation.draw(arrayWithImages[count],0,x);
    },
});

